package com.example.demo.service.Impl;

import com.example.demo.mapper.UserLogMapper;
import com.example.demo.model.UserLog;
import com.example.demo.service.IuserLogService;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@AllArgsConstructor
public class UserLogServiceImpl implements IuserLogService {

//    @Autowired
//    private UserLogMapper userLogMapper;
    private final UserLogMapper userLogMapper;

    @Override
    public List<UserLog> getAllUserLog() {
        return userLogMapper.getAllUserLog();
    }
    @Transactional
    @Override
    public void insertUserLog(UserLog userLog) {
        userLogMapper.insertUserLog(userLog);
    }

    @Transactional
    @Override
    public void deleteUserLogByUserId(Long userId) {
        userLogMapper.deleteUserLogByUserId(userId);
    }

    @Transactional
    @Override
    public void deleteAllUserLog() {
        userLogMapper.deleteAllUserLog();
    }
}
